package cn.mango.app.common;

import android.content.res.Resources;
import android.util.TypedValue;

public abstract class UnitUtils {
	public static final int convertDip2Px(Resources r, int dip)
	{
		return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, r.getDisplayMetrics());
	}
	
	public static final int convertSp2Px(Resources r, int sp)
	{
		return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, r.getDisplayMetrics());
	}
}
